<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Redis实现的社交功能 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .btn-primary {
            background: linear-gradient(to right, #667eea, #764ba2);
            transition: all 0.3s ease;
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 30px rgba(0,0,0,0.1);
        }
        .feature-icon {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            background: linear-gradient(to right, #667eea, #764ba2);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 3.5rem;
            line-height: 0.8;
            margin: 0.2rem 0.5rem 0 0;
            font-weight: 700;
            color: #667eea;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- 导航栏 -->
    <nav class="bg-white shadow-sm py-4">
        <div class="container mx-auto px-6 flex justify-between items-center">
            <div class="text-xl font-bold text-indigo-600">技术小馆</div>
            <div class="space-x-4">
                <a href="#" class="text-gray-700 hover:text-indigo-600">首页</a>
                <a href="#" class="text-gray-700 hover:text-indigo-600">项目</a>
                <a href="#" class="text-gray-700 hover:text-indigo-600">关于</a>
                <a href="#" class="text-gray-700 hover:text-indigo-600">联系</a>
            </div>
        </div>
    </nav>

    <!-- Hero 模块 -->
    <header class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 flex flex-col md:flex-row items-center">
            <div class="md:w-1/2 mb-10 md:mb-0">
                <h1 class="text-4xl md:text-5xl font-bold mb-4">基于Redis的社交互动功能实现</h1>
                <p class="text-xl mb-8 opacity-90">高性能、高并发的点赞、关注与评论系统</p>
                <a href="#download" class="btn-primary text-white py-3 px-8 rounded-full font-semibold inline-block">获取源码</a>
            </div>
            <div class="md:w-1/2 flex justify-center">
                <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1651558013301-302e524b-b5cc-4be5-9156-b400285168f7.png" 
                     alt="Redis社交功能图示" 
                     class="rounded-lg shadow-xl max-w-full h-auto">
            </div>
        </div>
    </header>

    <!-- 主要内容区 -->
    <main class="container mx-auto px-6 py-16">
        <!-- 项目介绍 -->
        <section class="mb-20">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold mb-2 text-gray-800">项目介绍</h2>
                <div class="w-20 h-1 bg-indigo-600 mx-auto"></div>
            </div>
            
            <article class="prose max-w-4xl mx-auto drop-cap">
                <p class="text-lg text-gray-700 leading-relaxed">
                    本项目实现了一个高性能的社交互动功能系统，包括点赞、关注和评论三大核心功能。系统基于Redis构建，充分利用其内存存储、高性能和丰富的数据结构特性，能够轻松应对高并发场景。
                </p>
                <p class="text-lg text-gray-700 leading-relaxed mt-4">
                    Redis作为内存数据库，其读写速度远超传统关系型数据库，特别适合处理频繁变更的社交互动数据。本项目通过合理的数据结构设计和算法优化，实现了毫秒级的响应时间和高可用性。
                </p>
            </article>
        </section>

        <!-- 功能特色 -->
        <section class="mb-20">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold mb-2 text-gray-800">功能特色</h2>
                <div class="w-20 h-1 bg-indigo-600 mx-auto"></div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-8">
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon">
                        <i class="fas fa-thumbs-up"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">高性能点赞</h3>
                    <p class="text-gray-600">基于Redis集合实现的高性能点赞系统，支持瞬时响应和精确计数，解决传统数据库的性能瓶颈问题。</p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon">
                        <i class="fas fa-user-plus"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">实时关注</h3>
                    <p class="text-gray-600">利用Redis的有序集合实现粉丝关系管理，支持快速查询、分页和排名，保证关系变更的实时性。</p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon">
                        <i class="fas fa-comments"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">即时评论</h3>
                    <p class="text-gray-600">通过Redis列表结构实现的评论系统，支持快速发布、分页读取和热评排序，提升用户体验。</p>
                </div>
            </div>
        </section>

        <!-- 技术实现 -->
        <section class="mb-20">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold mb-2 text-gray-800">技术实现</h2>
                <div class="w-20 h-1 bg-indigo-600 mx-auto"></div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-8">
                    <h3 class="text-2xl font-bold mb-4 text-gray-800">Redis数据结构设计</h3>
                    <div class="mermaid mb-6">
                        graph TD
                            A[点赞功能] --> B[使用SET存储]
                            A --> C[Key: like:content:{id}]
                            D[关注功能] --> E[使用ZSET存储]
                            D --> F[Key: follow:{uid}]
                            G[评论功能] --> H[使用LIST存储]
                            G --> I[Key: comment:{content_id}]
                    </div>
                    <p class="text-gray-700">
                        系统充分利用Redis的各种数据结构特性：点赞使用SET确保唯一性，关注使用ZSET实现排序和分页，评论使用LIST保证顺序。每种操作的时间复杂度均为O(1)或O(logN)，性能极高。
                    </p>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <h3 class="text-xl font-bold mb-4 text-gray-800">高并发处理</h3>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>使用Redis原子操作避免竞态条件</li>
                        <li>批量操作减少网络往返</li>
                        <li>Pipeline提升吞吐量</li>
                        <li>Lua脚本保证操作原子性</li>
                    </ul>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <h3 class="text-xl font-bold mb-4 text-gray-800">数据一致性</h3>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>异步持久化到MySQL</li>
                        <li>定期同步关键数据</li>
                        <li>失败重试机制</li>
                        <li>监控报警系统</li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- 下载区域 -->
        <section id="download" class="mb-20">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold mb-2 text-gray-800">获取源码</h2>
                <div class="w-20 h-1 bg-indigo-600 mx-auto"></div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-8 md:p-12">
                    <div class="flex flex-col md:flex-row items-center">
                        <div class="md:w-1/2 mb-8 md:mb-0">
                            <h3 class="text-2xl font-bold mb-4 text-gray-800">立即下载完整项目</h3>
                            <p class="text-gray-700 mb-6">包含完整的源代码、文档和使用说明，帮助您快速理解并部署这套高性能社交互动系统。</p>
                            <a href="https://pan.baidu.com/s/1jEwVffwAY_QwV1-rlyvqBw" 
                               class="btn-primary text-white py-3 px-8 rounded-full font-semibold inline-block"
                               target="_blank">
                                <i class="fas fa-download mr-2"></i>下载源码 (提取码: s1c7)
                            </a>
                        </div>
                        <div class="md:w-1/2 flex justify-center">
                            <div class="bg-gray-100 p-6 rounded-lg border border-gray-200">
                                <h4 class="font-bold mb-3 text-gray-800 flex items-center">
                                    <i class="fas fa-info-circle text-indigo-600 mr-2"></i>
                                    源码说明
                                </h4>
                                <ul class="text-gray-700 space-y-2">
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>完整的Java/Spring实现</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>Redis配置示例</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>API接口文档</span>
                                    </li>
                                    <li class="flex items-start">
                                        <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                        <span>性能测试报告</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-6">
            <div class="text-center">
                <h2 class="text-2xl font-bold mb-4">技术小馆</h2>
                <p class="mb-6 text-gray-400">探索技术之美，分享编程之乐</p>
                <div class="flex justify-center space-x-4">
                    <a href="http://www.yuque.com/jtostring" 
                       class="text-gray-400 hover:text-white transition-colors"
                       target="_blank">
                        <i class="fas fa-globe text-xl"></i>
                    </a>
                </div>
                <p class="mt-6 text-gray-500 text-sm">
                    &copy; 2023 技术小馆. 保留所有权利.
                </p>
                <p class="text-gray-500 text-sm mt-2">
                    <a href="http://www.yuque.com/jtostring" class="hover:text-gray-300" target="_blank">http://www.yuque.com/jtostring</a>
                </p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>